/*
 * @Author: wzt 1602453034@qq.com
 * @Date: 2023-09-11 10:33:21
 * @LastEditors: 夏之一周 1602453034@qq.com
 * @LastEditTime: 2023-09-25 00:02:23
 * @FilePath: \front_end\main\src\api\fetch\index.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
const BAST_URL= import.meta.env.VITE_BAST_URL;

export async function FetchPOST(url:string,params?:any,options?:any){    
    try{
        const res = await fetch(BAST_URL+url,{
            method:'POST',
            body:JSON.stringify(params),
            ...options,
        })
        return await res.json();
    }catch(err){
        console.log(err);
    }
}
export async function FetchGET(url:string){
    try{
        const res = await fetch(BAST_URL+url+`?`)
        return await res.json()
    }catch(err){
        console.log(err);
    }
}
